Skip to content

Conversation

@dissto
Copy link
Collaborator

@dissto dissto commented Sep 7, 2025

Let me know

it('`:dataset` column has the correct state', function (string $column): void {
    $records = App\Models\User::factory(3)->create();

    $record = $records->first();

    $value = data_get($record, $column);

    if ($value instanceof Carbon\Carbon || $value instanceof Carbon\CarbonImmutable) {
        $value = $value->toDateTimeString();
    }

    livewire(App\Filament\Resources\Users\Pages\ListUsers::class)
        ->assertTableColumnStateSet($column, $value, record: $record)
        ->assertTableColumnStateNotSet($column, 'non-existent-value', record: $record);
})
    ->with(['name', 'email', 'email_verified_at', 'created_at', 'updated_at']);

it('`:dataset` column has the correct formatted state', function (string $column): void {
    $records = App\Models\User::factory(3)->create();

    $record = $records->first();

    $value = data_get($record, $column);

    //     if ($value instanceof Carbon\Carbon || $value instanceof Carbon\CarbonImmutable ) {
    //        $value = $value->format('Y-m-d H:i:s');
    //     }

    livewire(App\Filament\Resources\Users\Pages\ListUsers::class)
        ->assertTableColumnFormattedStateSet($column, $value, record: $record)
        ->assertTableColumnFormattedStateNotSet($column, 'non-existent-value', record: $record);

})->with(['name', 'email', 'email_verified_at', 'created_at', 'updated_at'])
    ->skip('This test requires additional attention because the formatted state is likely to differ from the raw state.');

@dissto dissto marked this pull request as draft September 7, 2025 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants